package com.leunpha.mini.downloader.listener;

import com.leunpha.mini.downloader.bean.FileBean;
import com.leunpha.mini.net.events.NetEvent;
import com.leunpha.mini.net.events.NetState;
import com.leunpha.mini.net.listener.Listener;

import java.util.Map;

/**
 * User: zhoujingjie
 * Date: 14-6-30
 * Time: 下午5:08
 */
public abstract class DownloadErrorListener extends Listener {
    @Override
    public void update(NetEvent event) {
        if(event.getState() == NetState.ERROR){
            Map<String,Object> value = (Map<String, Object>) event.getValue();
            error((Throwable)value.get("throwable"),(FileBean)value.get("bean"));
        }
    }

    public abstract void error(Throwable t,FileBean bean);
}
